home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1995 March / Macworld CD-ROM (March 1995).cdr / Updaters / AppMaker 1.5.2->1.5.4 / Libraries / THINK / AMClassLibC / CAMArrayPane.cp < prev    next >
Encoding:
Text File  |  1991-11-24  |  2.8 KB  |  93 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  CAMArrayPane.c
  3.         
  4.     
  5.     SUPERCLASS = CAMTable
  6.     
  7.     Copyright © 1991 Bowers Development Corporation. All rights reserved.
  8.  
  9.  ******************************************************************************/
  10.  
  11. #include "CAMArrayPane.h"
  12. #include <TBUtilities.h>
  13.  
  14. /******************************************************************************
  15.  IViewTemp
  16.  
  17.      Initialize an AM Array Pane using a template
  18. ******************************************************************************/
  19. void CAMArrayPane::IViewTemp    (CView            *anEnclosure,
  20.                                   CBureaucrat    *aSupervisor,
  21.                                  Ptr            viewData)
  22. {
  23.     register        AMArrayPaneTempP        p;
  24.  
  25.     p = (AMArrayPaneTempP) viewData;
  26.     theTypeStyleP = &p->typeStyle;
  27.     inherited::IViewTemp (anEnclosure, aSupervisor, (Ptr)&p->sTableTemp);
  28.     theTypeStyleP = nil;
  29.  
  30. } /* IViewTemp */
  31.  
  32. /******************************************************************************
  33.  CreateTextEnvironment {OVERRIDE}
  34.  
  35.     Create and initialize the text environment used for drawing text.
  36.     Read the info from the saved style ptr.
  37. ******************************************************************************/
  38. void CAMArrayPane::CreateTextEnvironment (void)
  39. {
  40.     AMSetupTextEnvirons (this, &theTypeStyleP->editStyles);
  41.  
  42. } /* CreateTextEnvironment */
  43.  
  44. /******************************************************************************
  45.  HasSelection
  46.  
  47.     Returns a boolean to indicate whether anything is selected.
  48. ******************************************************************************/
  49. Boolean CAMArrayPane::HasSelection    (void)
  50. {
  51.     return (!EmptyRgn (GetSelection ()));
  52.  
  53. } /* HasSelection */
  54.  
  55. /******************************************************************************
  56.  GetChoice
  57.  
  58.     This is a wrapper routine for the very common kind of list which
  59.     has a single column and allows only one item to be selected.
  60.     Returns in its parameter the row (0..N) of the selected item.
  61.     Returns as function result whether anything is selected.
  62. ******************************************************************************/
  63. Boolean    CAMArrayPane::GetChoice        (short            *choice)
  64. {
  65.     Cell            aCell;
  66.  
  67.     SetPt (&aCell, 0, 0);
  68.     if (GetSelect (TRUE, &aCell)) {
  69.         *choice = aCell.v;
  70.         return (TRUE);
  71.     } else {
  72.         *choice = -1;
  73.         return (FALSE);
  74.     }
  75.  
  76. } /* GetChoice */
  77.  
  78. /******************************************************************************
  79.  SetChoice
  80.  
  81.     This is a wrapper routine for the very common kind of list which
  82.     has a single column and allows only one item to be selected.
  83.     Selects the cell in the specified row.
  84. ******************************************************************************/
  85. void    CAMArrayPane::SetChoice        (short            choice)
  86. {
  87.     Cell            aCell;
  88.  
  89.     SetPt (&aCell, 0, choice);
  90.     SelectCell (aCell, FALSE /*keepPrevious*/, TRUE /*reDraw*/);
  91.  
  92. } /* SetChoice */
  93.